<template>
  <div v-loading="loading">
    <p><span>通道状态：</span><span class="fz12 tip">{{ ws.enter_status }}</span></p>
    <p><span>状态信息：</span><span class="fz12 err">{{ ws.error_info }}</span></p>
    <p><span>经营地址：</span>{{ ws.area }}</p>
    <p><span>详细地址：</span>{{ ws.address }}</p>
    <p><span>经营类别：</span>{{ ws.industry }}</p>
    <p><span>蓝海行动：</span>{{ ws.is_blue ? '已参加': '未参加' }}</p>
    <p><span>选择渠道：</span>{{ ws.balance_type }}</p>
    <p><span>微信通道签约费率：</span>{{ ws.wx_rate }} %</p>
    <p><span>支付宝通道签约费率：</span>{{ ws.ali_rate }} %</p>
  </div>
</template>

<script>
import { merchanenlChannelWsQuery } from '@/api/shop'

export default {
  data() {
    return {
      loading: true,
      ws: {
        area: '',
        address: '',
        industry: '',
        is_blue: '',
        balance_type: '',
        wx_rate: '',
        ali_rate: '',
        enter_status: null,
        error_info: ''
      }
    }
  },
  methods: {
    handleDocumentInit() {
      merchanenlChannelWsQuery(this.$route.query.merchant_num).then(res => {
        if (res.data.errorCode === 0) {
          this.loading = false
          this.ws.area = res.data.result.area.name.toString()
          this.ws.address = res.data.result.address
          this.ws.industry = res.data.result.industry.name
          this.ws.is_blue = res.data.result.is_blue
          this.ws.balance_type = res.data.result.balance_type
          this.ws.wx_rate = res.data.result.wx_rate
          this.ws.ali_rate = res.data.result.ali_rate
          this.ws.error_info = res.data.result.enter_status.error_info
          this.ws.enter_status = res.data.result.enter_status.name
        } else {
          this.$message.error(res.data.errorMsg)
        }
      })
    }
  },
  created() {
    this.handleDocumentInit()
  }
}
</script>
